package hz.mobileproject.pda.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.Arrays;
import java.util.List;

import cn.droidlover.xdroidmvp.mvp.XActivity;
import hz.mobileproject.pda.R;
import hz.mobileproject.pda.listener.IKeyPlace;
import hz.mobileproject.pda.presenter.PKeyPlace;
import hz.mobileproject.pda.ui.activity.work.ImpBuWeiActivity;
import hz.mobileproject.pda.ui.activity.work.KeyPlace_logActivity;
import hz.mobileproject.pda.ui.activity.work.NoneImpBuWeiActivity;

/**
 * Created by zmybi on 2017/8/23.
 */

public class KeyPlaceActivity extends XActivity<PKeyPlace> implements View.OnClickListener,IKeyPlace {


    Integer[] int_image = {R.drawable.anquan,R.drawable.tanhua};
    Button mIvStartEduTalk;
    TextView mTvHelp;
    LinearLayout mLlTalkJilu;
    LinearLayout mLlNoneTalk;
    LinearLayout mLlDingzhi;
    private List<?> images = Arrays.asList(int_image);

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Banner banner = (Banner) findViewById(R.id.banner);
        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(images);
        //banner设置方法全部调用完毕时最后调用
        banner.start();

        mIvStartEduTalk = (Button) findViewById(R.id.iv_start_edu_talk);
        mIvStartEduTalk.setOnClickListener(this);
        mTvHelp = (TextView) findViewById(R.id.tv_help);
        mTvHelp.setOnClickListener(this);
        mLlTalkJilu = (LinearLayout) findViewById(R.id.ll_talk_jilu);
        mLlTalkJilu.setOnClickListener(this);
        mLlNoneTalk = (LinearLayout) findViewById(R.id.ll_none_talk);
        mLlNoneTalk.setOnClickListener(this);
        mLlDingzhi = (LinearLayout) findViewById(R.id.ll_dingzhi);
        mLlDingzhi.setOnClickListener(this);
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_start_edu_talk:

                startActivity(new Intent(KeyPlaceActivity.this,ImpBuWeiActivity.class));
                break;
            case R.id.tv_help:
                ToastUtils.showLong("帮助");
                break;
            case R.id.ll_talk_jilu:  //巡查记录
//                ToastUtils.showLong("谈话记录");
                startActivity(new Intent(KeyPlaceActivity.this,KeyPlace_logActivity.class));
                break;
            case R.id.ll_none_talk:
                startActivity(new Intent(KeyPlaceActivity.this,NoneImpBuWeiActivity.class));
                break;
            case R.id.ll_dingzhi:
                ToastUtils.showLong("后续定制开发");
                break;
        }
    }

    @Override
    public void onWidgetClick(View view) {

    }

    @Override
    public void initData(Bundle savedInstanceState) {


    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_keyplace;
    }

    @Override
    public PKeyPlace newP() {
        return new PKeyPlace();
    }


    @Override
    public void showError(Exception e) {

    }

    @Override
    public void showData(String s, int type) {

        switch (type){
            case 502:
                break;
            case 200:
                break;
        }
    }


    public class GlideImageLoader extends ImageLoader {

        @Override
        public void displayImage(Context context, Object path, ImageView imageView) {
            Glide.with(context).load((Integer) path).into(imageView);
        }
    }


}
